<?php
/**
 *
 *
 */
class Yz_Property_String
    extends Yz_Property_Scalar
{

    protected $maxLength;


    /** Test if a value is a valid string, possibly meeting length constraint and other requirements
     *  @param mixed value
     *  @return string
     *  @throw InvalidArgument
     */
    public function testValue($value)
    {
        $value = parent::testValue($value);
        if (null === $value)
            return null;
        return Yz_String::test($value);
    }

    /**
     *
     */
    protected function maxLength()
    {
        $max =& $this->maxLength;
        if (null === $max)
            $max = Yz_Int::valueOf($this->fetchConfig('maxLength', 0));
        return $max;
    }
}
